import sys
import requests

sys.path.append("..\\..\\..\\study")

sys.path.append("..\\..\\..\\utils")


import ccwfile
url_base = "http://img.netbian.com/file/2021/0628/4a7080e1c65235fa5a2a1e4c67070786.jpg"

name=12
def xx():
    name=13
cookie="Hm_lvt_14b14198b6e26157b7eba06b390ab763=1626058400,1626137777,1626224865; xygkqecookieinforecord=%2C19-23706%2C; xygkqecookieclassrecord=%2C1%2C; yjs_js_security_passport=5aa5eddfc63cb3bf8d5dc3c57bb1fc2cac6b0374_1626232930_js; Hm_lpvt_14b14198b6e26157b7eba06b390ab763=1626233334"

headers = {
"Host": "img.netbian.com",
"Connection": "keep-alive",
"Cache-Control": "max-age=0",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9",
"Cookie": cookie,
"If-None-Match": "60d9e1cf-a8928",
"If-Modified-Since": "Mon, 28 Jun 2021 14:50:55 GMT"

}

if __name__ == '__main__':
    res = requests.get(url=url_base,headers=headers)
    res.encoding = 'gbk'
    cookie_new=res.headers.get('Set-Cookie')
    print(cookie_new)

    print(res.status_code==503)
    #url = "http://localhost:18085/chenchen-fast/file/upload"
    #file_path="11.jpg"
    #ccwfile.upload_file(url,file_path)
    # ssd=[12]
    # if ssd:
    #     print(1)
    # else:
    #     print(2)
    with open('111', 'wb') as f:
        f.write(res.content)
    #print(res.text)
